﻿@model TaskModel

@{
    var info = Model.LastExecutionInfo;
    var hasError = info.Error.HasValue();
}

<div sm-if="!info.IsRunning && !info.FinishedOn.HasValue" class="text-muted">@T("Common.Never")</div>
<div sm-if="info.Id != 0">
	<div>@info.StartedOn.ToString("g")</div>
	<div class="text-muted">@info.FinishedOnPretty</div>
	<div sm-if="info.Duration.HasValue()">
		<span>@T("Common.Duration"): </span> <span class="muted">@info.Duration</span>
	</div>
	<div sm-if="hasError" class="text-danger mt-2">
		<strong class="font-weight-medium">@T("Common.Error"): </strong> <span>@info.Error.Truncate(100, "…")</span>
	</div>
	<div sm-if="hasError && info.SucceededOn.HasValue && info.SucceededOn != info.FinishedOn">
		<span>@T("Admin.System.ScheduleTasks.LastSuccess"): </span> <span class="muted">@info.SucceededOn.Value.ToString("g")</span>
	</div>
</div>